package com.stylefeng.guns.core.util;

import org.springframework.http.HttpStatus;
import org.springframework.util.ObjectUtils;

public class ResponseData<T> {
    private  T body;
    private  Object code;

    public void setBody(T body) {
        this.body = body;
    }

    public Object getCode() {
        return code;
    }

    public void setCode(Object code) {
        this.code = code;
    }

    public ResponseData(ServiceStatus code) {
        this.body=null;
        this.code=code;
    }

    public ResponseData(T body, ServiceStatus code) {
        this.body=body;
        this.code=code;
    }

    public T getBody() {
        return this.body;
    }

    public boolean hasBody() {
        return this.body != null;
    }



    public int hashCode() {
        return  ObjectUtils.nullSafeHashCode(this.body);
    }

    public String toString() {
        StringBuilder builder = new StringBuilder("<");
        if (this.body != null) {
            builder.append(this.body);

        }



        builder.append('>');
        return builder.toString();
    }
}
